<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_refund_reason), new_object_url, { icon: 'plus', id: 'admin_new_named_type', class: "btn-primary" } %>
<% end if can? :create, Spree::RefundReason %>

<%= render partial: 'spree/admin/shared/returns_and_refunds_nav' %>

<% if @collection.any? %>
  <div class="table-responsive card-lg p-0">
    <table class="table" id='listing_named_types">
      <thead class="text-muted">
      <tr>
        <th><%= Spree.t(:name) %></th>
        <th><%= Spree.t(:status) %></th>
        <th><%= Spree.t(:mutable) %></th>
        <th></th>
      </tr>
      </thead>
      <tbody id="<%= plural_resource_name(Spree::RefundReason).to_s.parameterize.underscore %>">
      <% @collection.each do |refund_reason| %>
        <tr id="<%= spree_dom_id refund_reason %>">
          <td class="w-40 align-center">
            <%= refund_reason.name %>
          </td>
          <td class="w-20 align-center">
            <%= active_badge(refund_reason.active, label: Spree.t(refund_reason.active? ? :active : :inactive)) %>
          </td>
          <td class="w-10 align-center">
            <%= active_badge(refund_reason.mutable) %>
          </td>
          <td class="actions w-10">
            <% if refund_reason.mutable? %>
              <%= link_to_edit(refund_reason, no_text: true, data: { row_link_target: :link }) if can? :edit, refund_reason %>
            <% end %>
          </td>
        </tr>
      <% end %>
      </tbody>
    </table>
  </div>
<% else %>
  <%= render 'spree/admin/shared/no_resource_found' %>
<% end %>
